package com.ys.controller.web.overseas;

import com.ys.config.MenuId;
import com.ys.entity.overseas.TosProductActive;
import com.ys.service.overseas.TosProductActiveService;
import com.ys.service.sys.CommonApiService;
import com.ys.vo.W;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * HW商品listing库
 */
@Controller
@RequestMapping("/web/overseas/tosProductActive")
public class WebTosProductActiveController {
	private static final Logger logger = LoggerFactory.getLogger(WebTosProductActiveController.class);

	@Autowired
	private CommonApiService<TosProductActive> commonApiService;

    @Autowired
    private TosProductActiveService tosProductActiveService;

    private final Long MENU_ID = MenuId.TOS_ProductActive;



    /*
     * 编辑
     */
    @GetMapping("/toEdit")
    public String toEdit(Model model, HttpServletRequest request, HttpServletResponse response, long id) {
        try {

            Map<String, Object> extraParam = tosProductActiveService.getExtraParam(id);

            return commonApiService.toEdit(model,Long.parseLong(extraParam.get("id").toString()), new TosProductActive(), MENU_ID, extraParam, null);

        }catch (Exception e) {
            logger.error("编辑页面出错：",e.getMessage(),e);
            return W.error(model, e.getMessage());
        }
    }



    //批量上传文件
    @GetMapping("/imgBatch")
    public String imgBatch(Model model){
        //model.addAttribute("onProcess", onProcess);
        return "overseas/tosProductActive/imgFileBatch";
    }




}






